<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>客户编辑</title>
	<!-- import css and js --> 
	<%@ include file="/common/metaInput.jsp" %>  
	<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
	<script type="text/javascript" src="${ctx}/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
var basic_Url="${ctx}/basic/customer";
var grid2;
$(function(){
$("#inputForm").validate({			   
	onsubmit: true,
	 /*执行ajaxsubmit  */ 
    submitHandler: function(editform) {
            
        //alert(jsonInfo); 
        try{			    		
            url =  basic_Url+"/save.do";
            var api = frameElement.api;
        	var W = api.opener;
        
            getReturnMessage(url,"inputForm",W.searchAP);
        }catch(e){alert(e);}
    }
 }
);
}); 

var i="first";
function submitForm(param){
    //设置ajax全局同步
	jQuery.ajaxSettings.async = false;
  	$("#submitFlag").val(param);
  	$("#newVal").val(JSON.stringify(grid2.getData()));
  	$("#recordData").val(JSON.stringify(grid1.getData()));
    $("#inputForm").submit();
 }	
$(function(){
	var sex=[{
		'saveData':'M','showData':'男'
	},{
		'saveData':'W','showData':'女'
	}
];
	grid2 =$("#table1").ligerGrid({
        columns: [
				  { hide : 'id', name: 'id', width: 180 ,editor: { type: 'text'}},
				  { display: '联系人编码', name: 'zd002Code', width: 100 ,editor: { type: 'text'}},
				  { display: '联系人英文名', name: 'zd003EnName', width: 100 ,editor: { type: 'text'}},
                  { display: '联系人中文名', name: 'zd003ZhName', width: 100,editor: { type: 'text'}},
                  { display: '性别', name: 'zd004Sex', width: 40 ,editor: { type: 'select',data:sex,valueField: 'saveData', textField: 'showData'},
                	  render: function (item){
                		 if(item.zd004Sex=='M'){
                			 return '男';
                		 }else{
                			 return '女';
                		 }
                	  }  
                  
                  },
                  { display: '职务', name: 'zd005Duty', width: 80,editor: { type: 'text'}},
                  { display: 'QQ', name: 'zd008Qq', width: 100,editor: { type: 'text'}},
                  { display: '电话1', name: 'zd006PhoneOne', width: 100,editor: { type: 'text'}},
                  { display: '电话2', name: 'zd006PhoneTwo', width: 120,editor: { type: 'text'}},
                  { display: '手机1', name: 'zd007MobelOne', width: 100,editor: { type: 'text'}},
                  { display: '手机2', name: 'zd007MobelTwo', width: 100,editor: { type: 'text'}},
                  { display: '邮箱', name: 'zd009Mail', width: 140,editor: { type: 'text'}},
                  { display: '传真', name: 'zd010Fax', width: 100,editor: { type: 'text'}},
                  { display: '助记码', name: 'bizMnemonic', width: 100 ,editor: { type: 'text'}},
                  { display: '其他', name: 'zd011Other', width: 100,editor: { type: 'text'}}
                      ],  usePager: true,pageSize:15,enabledEdit: true,
                      url : basic_Url+"/contactList.do?zd001CustId=${customer.id}",enabledSort:false,
                      width: "100%", height:200,pageSizeOptions :[15,25,35], checkbox: true, 
                      toolbar: { items: [
   									  { text: '添加行', click: addNewRow, icon: 'add' },
                                         { line: true },
                                         { text: '删除行', click: deleteOldRow, img: '${ctx}/js/ligerUI/skins/icons/delete.gif' }
                                         ]
                                         }
                  });
	$("#pageloading").hide();
});
var grid1;
$(function(){
	grid1 =$("#table2").ligerGrid({
        columns: [
				  { hide : 'id', name: 'id', width: 180 ,editor: { type: 'text'}},
				  { display: '联系人英文名', name: 'zd002EnName', width: 100 ,editor: { type: 'text'}},
                  { display: '联系人中文名', name: 'zd002ZhName', width: 80,editor: { type: 'text'}},
                  { display: '联系记录', name: 'zd003Record', width: 80 ,editor: { type: 'text'}},
                  { display: '联系日期', name: 'zd004Date', width: 120,editor: { type: 'scdate'}},
                  { display: '我方人员ID', name: 'zd005WeId', width: 100,editor: { type: 'text'}},
                  { display: '我方人员编码', name: 'zd005WeCode', width: 100,editor: { type: 'text'}},
                  { display: '我方人员名字', name: 'zd005WeName', width: 100,editor: { type: 'text'}},
                  { display: '评分', name: 'zd006Score', width: 40,editor: { type: 'text'}},
                      ],  usePager: true,pageSize:15,enabledEdit: true,
                      url : basic_Url+"/recordList.do?zd001CustId=${customer.id}",enabledSort:false,
                      width: "100%", height:200,pageSizeOptions :[15,25,35], checkbox: true, 
                      toolbar: { items: [
   									  { text: '添加行', click: addNewRow1, icon: 'add' },
                                         { line: true },
                                         { text: '删除行', click: deleteOldRow1, img: '${ctx}/js/ligerUI/skins/icons/delete.gif' }
                                         ]
                                         }
                  });
	$("#pageloading").hide();
});
function addNewRow1(){
	grid1.addEditRow();
}
function deleteOldRow1(){
	grid1.deleteSelectedRow();
}

function addNewRow(){
	grid2.addEditRow();
}
function deleteOldRow(){
	grid2.deleteSelectedRow();
}



$(function(){
			$("#zd003ZhName").change(function(){
				$("#bizMnemonic").val(helpCode($("#zd003ZhName").val()))
			});
		});
</script>

</head>

<body>

<form id="inputForm" action="" method="post">
<input type="hidden" id="id" name="id" value="${customer.id}"/>
<input type="hidden" id="bizVersion" name="bizVersion" value="${customer.bizVersion}"/>
<input type="hidden" id="newVal" name="newVal"/>
<input type="hidden" id="recordData" name="recordData"/>
<!-- 用于标识提交按钮 -->
<input type="hidden" id="submitFlag" value="" />
 <div class="pageContent" >
    <div class="panel">
         <table class="TableBlock" align="center">
         			<tr>
                    <td>编码:</td>
   		                 <td>
   		                <input type="text" id="zd001Code" name="zd001Code" readonly="readonly" style="width: 40%;"  value="${customer.zd001Code}" />
   		                 </td>
   		                  <td >中文名称:</td>
   		                 <td>
   		                <input type="text" id="zd003ZhName" name="zd003ZhName" style="width: 40%;" class="required" value="${customer.zd003ZhName}" />
   		                 </td>
   		           </tr>
                   <tr>
   		             <td >英文名称:</td>
   		                 <td>
   		                <input type="text" id="zd002EnName" name="zd002EnName" style="width: 40%;" value="${customer.zd002EnName}" />
   		                 </td>       
   		                 <td >助记码:</td>
   		                 <td>
   		                <input type="text" id="bizMnemonic" name="bizMnemonic" style="width: 40%;" value="${customer.bizMnemonic}" />
   		                 </td>  
   		           </tr>
   		            <tr>
                    <td >中文描述:</td>
   		                 <td>
   		                <input type="text" id="zd005ZhDesp" name="zd005ZhDesp" style="width: 40%;" value="${customer.zd005ZhDesp}" />
   		                 </td>
   		             <td >英文描述:</td>
   		                 <td>
   		                <input type="text" id="zd004EnDesp" name="zd004EnDesp" style="width: 40%;" value="${customer.zd004EnDesp}" />
   		                 </td>     
   		           </tr>
   		           <tr>
                    	<td >联系人:</td>
   		                 <td>
   		                	<input type="text" id="zd006Contacts" name="zd006Contacts" style="width: 40%;" value="${customer.zd006Contacts}" />
   		                 </td>
   		              	<td >电话:</td>
   		                 <td>
   		                	<input type="text" id="zd007Tel" name="zd007Tel" style="width: 40%;" value="${customer.zd007Tel}" />
   		                 </td>    
   		           </tr>
   		           <tr>
                    	<td >手机:</td>
   		                 <td>
   		                <input type="text" id="zd008Phone" name="zd008Phone" style="width: 40%;" value="${customer.zd008Phone}" />
   		                 </td>
   		                  <td >传真:</td>
   		                 <td>
   		                <input type="text" id="zd011Fax" name="zd011Fax" style="width: 40%;" value="${customer.zd011Fax}" />
   		                 </td>
   		           </tr>
   		        	<tr>
                    	<td >邮箱:</td>
   		                 <td>
   		                <input type="text" id="zd010Email" name="zd010Email" style="width: 40%;" value="${customer.zd010Email}" />
   		                 </td>
   		                 <td >QQ:</td>
   		                 <td>
   		                <input type="text" id="zd009QQ" name="zd009QQ" style="width: 40%;" value="${customer.zd009QQ}" />
   		                 </td>
   		           </tr>
   		            <tr>
   		            <td >区域:</td>
   		                 <td>
   		                <input type="text" id="zd013Area" name="zd013Area" style="width: 40%;" value="${customer.zd013Area}" />
   		                 </td>
   		                 <td >城市:</td>
   		                 <td>
   		                <input type="text" id="zd014City" name="zd014City" style="width: 40%;" value="${customer.zd014City}" />
   		                 </td>
   		           </tr>
   		           <tr>
   		            <td >行业:</td>
   		                 <td>
   		                <input type="text" id="zd015Industry" name="zd015Industry" style="width: 40%;" value="${customer.zd015Industry}" />
   		                 </td>
   		                 <td >网址:</td>
   		                 <td>
   		                <input type="text" id="zd016Website" name="zd016Website" style="width: 40%;" value="${customer.zd016Website}" />
   		                 </td>
   		           </tr>
   		           <tr>
   		            <td >级别:</td>
   		                 <td>
   		                <input type="text" id="zd017Level" name="zd017Level" style="width: 40%;" value="${customer.zd017Level}" />
   		                 </td>
   		                 <td >税种:</td>
   		                 <td>
   		                <input type="text" id="zd018Taxes" name="zd018Taxes" style="width: 40%;" value="${customer.zd018Taxes}" />
   		                 </td>
   		           </tr>
   		            <tr>
   		            <td >开户行:</td>
   		                 <td>
   		                <input type="text" id="zd019Bank" name="zd019Bank" style="width: 40%;" value="${customer.zd019Bank}" />
   		                 </td>
   		                 <td >银行账号:</td>
   		                 <td>
   		                <input type="text" id="zd020BankAccount" name="zd020BankAccount" style="width: 40%;" value="${customer.zd020BankAccount}" />
   		                 </td>
   		           </tr>
   		           <tr>
   		           <td >账户名称:</td>
   		                 <td>
   		                <input type="text" id="zd021BankName" name="zd021BankName" style="width: 40%;" value="${customer.zd021BankName}" />
   		                 </td>
   		                  <td >邮政编码:</td>
   		                 <td>
   		                <input type="text" id="zd025ZipCode" name="zd025ZipCode" style="width: 40%;" value="${customer.zd025ZipCode}" />
   		                 </td>
   		                  
   		           </tr>
   		            <tr>
   		            	<td >合同编号:</td>
   		                 <td>
   		                <input type="text" id="zd022ContNo" name="zd022ContNo" style="width: 40%;" value="${customer.zd022ContNo}" />
   		                 </td>
   		           		<td >合同期限:</td>
   		                 <td>
   		                <input type="text" id="zd024ContPeriod" name="zd024ContPeriod" style="width: 40%;" value="${customer.zd024ContPeriod}" />
   		                 </td>
   		           </tr>
   		            <tr>
   		            	<td >营业执照:</td>
   		                 <td>
   		                <input type="text" id="zd026BusLicense" name="zd026BusLicense" style="width: 40%;" value="${customer.zd026BusLicense}" />
   		                 </td>
   		           		<td >营业有效期:</td>
   		                 <td>
   		                <input type="text" id="zd027ValidBusLicense" name="zd027ValidBusLicense" style="width: 40%;" value="${customer.zd027ValidBusLicense}" />
   		                 </td>
   		           </tr>
   		            <tr>
   		            	<td >注册类型:</td>
   		                 <td>
   		                <input type="text" id="zd028RegType" name="zd028RegType" style="width: 40%;" value="${customer.zd028RegType}" />
   		                 </td>
   		           		<td >注册资金:</td>
   		                 <td>
   		                <input type="text" id="zd029RegCapital" name="zd029RegCapital" style="width: 40%;" value="${customer.zd029RegCapital}" />
   		                 </td>
   		           </tr>
   		           <tr>
                    <td >公司地址:</td>
   		                 <td>
   		                <input type="text" id="zd023Address" name="zd023Address" style="width: 40%;" value="${customer.zd023Address}" />
   		                 </td>
   		                  <td >国家:</td>
   		                 <td>
   		                <input type="text" id="zd030Country" name="zd030Country" style="width: 40%;" value="${customer.zd030Country}" />
   		                 </td>
   		           </tr>
   		           <tr>
   		           	<td >备注:</td>
   		           	<td colspan="3"><input id="zd031Remark" name="zd031Remark" style="width: 40%;" value="${customer.zd031Remark}" /></td>
   		           </tr>
                </table> 
                <div id="table1"></div>
                <div id="table2"></div>              
         </div>
         <div class="formBar">
	        <ul>
		       <li><div class="buttonActive"><div class="buttonContent"><button type="button" id="save" onclick="submitForm(1)">保存</button></div></div></li>
		       <li><div class="button"><div class="buttonContent"><button type="button" class="print" onclick="CloseDialog()">关闭</button></div></div></li>
	        </ul>
        </div>    
    </div>
	
</form>
	
</body>
</html>
